<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>用户管理</title>
<link rel="stylesheet" type="text/css" href="../css/default.css">
<link rel="stylesheet" type="text/css" href="../js/jquery-easyui-1.3.5/themes/gray/easyui.css">
<link rel="stylesheet" type="text/css" href="../js/jquery-easyui-1.3.5/themes/icon.css" />
<script type="text/javascript" src="../js/jquery-easyui-1.3.5/jquery-1.10.2.min.js"></script>
<script type="text/javascript" src="../js/jquery-easyui-1.3.5/jquery.easyui.min.js"></script>
<script type="text/javascript" src="../js/extends.js"></script>
<script type="text/javascript" src="../js/common.js"></script>
<script type= "text/javascript" src="../ta/js5/domutil.js" ></script>  
<script>
var editIndex = undefined;
function editBatch1(){
var ed = $('#ProcessRelation').datagrid('getEditor', {index:1,field:'birthday'});
ed.init(); 
}
        	function editBatch(){
         $('#tt').datagrid('appendRow', {         
                 FlowTypeName: 'new name',
                 FlowTypeCode: 30                
             });
        }  
        function removeit(){
        	/*var selectedId = $('#tt').datagrid('getSelections');  
        	alert(selectedId);
			if (editIndex == undefined){return}
			$('#tt').datagrid('deleteRow', selectedId);
			editIndex = undefined;
			*/
			
			var row = $('#tt').datagrid('getSelected');
 if (row) {
          var rowIndex = $('#tt').datagrid('getRowIndex', row);
          $('#tt').datagrid('deleteRow', rowIndex);  
  }


		}

$(function(){
	$("#tt").datagrid({
		height:$("#body").height()-$('#search_area').height()-5,
		width:$("#body").width(),
		idField:'userId',
		//data: data,
		url:"datagrid.json",  
		singleSelect:true, 
		nowrap:true,
		fitColumns:true,
		rownumbers:true,
		showPageList:false,
		selectOnCheck: true,
		checkOnSelect: true,
		columns:[[
		    {field:'ck',checkbox:true},
			{field:'userName',title:'用户名',width:100,halign:"center", align:"left"},
			{field:'name',title:'姓名',width:100,halign:"center", align:"left"},
			{field:'sex',title:'性别',width:100,halign:"center", align:"left"},
			{field:'department',title:'部门',width:100,halign:"center", align:"left"}
		]],
		toolbar:'#tt_btn',  
        pagination:true,
		onDblClickRow:function(rowIndex, rowData){
			viewDetail(rowData.userId);
		}
	});
	
	$.getJSON("datagrid.json",function(data){
    $('#tt').datagrid("loadData",data);//将数据绑定到DataGrid中  
});
	
	
	//新增弹出框
	$("#save").on("click", function(){
		$parent("#parent_win").window({
			width:274,
			height:225,
			href:'user/addUser.html',
			title:'新增用户'
		});
	});
	//修改
	$("#update").on("click", function(){
		$parent("#parent_win").window({
			width:274,
			height:225,
			href:'user/addUser1.html',
			title:'用户信息修改'
		});
	});
	//删除
	$("#delete").on("click", function(){
		$parent("#parent_win").window({
			width:274,
			height:225,
			href:'user/addUser2.html',
			title:'用户信息删除'
		});
	});
})
</script>
</head>
<body class="easyui-layout">
<div id="body" region="center" > 
  <!-- 查询条件区域 -->
  <div id="search_area" >
    <div id="conditon">
      <table border="0">
        <tr>
          <td>用户名：</td>
          <td ><input  name="userName" id="userName"   /></td>
          <td>&nbsp;性别：</td>
          <td><input  name="sex" id="sex"  /></td>
          <td>&nbsp;部门：</td>
          <td><input  name="department" id="department" /></td>
          <td>
              <a  href="javascript:void(0)" class="easyui-linkbutton my-search-button" iconCls="icon-search" plain="true" onclick="alert('查无此人！')">查询</a> 
              <a  href="javascript:void(0)" class="easyui-linkbutton my-search-button" iconCls="icon-reset" plain="true" onclick="window.location.reload()">重置</a>
          </td>
        </tr>
      </table>
    </div>
    <span id="openOrClose"></span> 
  </div>
    <!-- 表格顶部工具按钮 -->
  <div id="tt_btn">
  	<div style="width:40%; float: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
      <a href="javascript:void(0)"  id="save" class="easyui-linkbutton" iconCls="icon-add" plain="true"><button>新增</button></a>
      <a href="javascript:void(0)"  id="update" class="easyui-linkbutton" iconCls="icon-edit" plain="true"><button>修改</button></a> 
      </div>
      <div>
      	<br>
      	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
      	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
      	<button onclick="removeit()">删除选中行</button></div>
  </div>
  <!-- 数据表格区域 -->
<table id="tt"></table>
</body>

</html>
